﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using PreguntaAlExperto.DataFramework;
using PreguntaAlExperto.RulesLayer.Entities;
using PreguntaAlExperto.TransporterObjectsFramework;
using PreguntaAlExperto.RulesLayer.ObjectMapper.Contracts;

namespace PreguntaAlExperto.ObjectMapper.DTO
{
    internal class FollowersDTO
        : BaseDTO
    {
        public object Select(string query, SearchCriteria searchCriteria)
        {
            DataAccess dataAccess = new DataAccess();
            BaseList<Followers> _transporter = new BaseList<Followers>();

            foreach (object rawEntity in dataAccess.Select(query, searchCriteria))
            {
                Followers _follower = new Followers();
                _follower.ID = int.Parse(((ArrayList)rawEntity)[0].ToString());
                _follower.Name = ((ArrayList)rawEntity)[1].ToString();
                _follower.Email = ((ArrayList)rawEntity)[2].ToString();
                _transporter.Add(_follower);
            }
            _transporter.TotalRecords = dataAccess.getRecordsAfected;
            return _transporter;
        }
    }
}
